{
  "metadata" : {
    "name" : "Magic Plots",
    "user_save_timestamp" : "1970-01-01T01:00:00.000Z",
    "auto_save_timestamp" : "1970-01-01T01:00:00.000Z",
    "language_info" : {
      "name" : "scala",
      "file_extension" : "scala",
      "codemirror_mode" : "text/x-scala"
    },
    "trusted" : true,
    "customLocalRepo" : null,
    "customRepos" : null,
    "customDeps" : null,
    "customImports" : null,
    "customArgs" : null,
    "customSparkConf" : null
  },
  "cells" : [ {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "id" : "2F1FA7D1E1BF4300AAE64809523EA665"
    },
    "cell_type" : "code",
    "source" : "import scala.util.Random._",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "id" : "B4EF487E6F2342DE820E5084DE345AF8"
    },
    "cell_type" : "markdown",
    "source" : "## Plot list of numbers"
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "presentation" : {
        "tabs_state" : "{\n  \"tab_id\": \"#tab1076163454-0\"\n}",
        "pivot_chart_state" : "{\n  \"hiddenAttributes\": [],\n  \"menuLimit\": 200,\n  \"cols\": [\n    \"_2\"\n  ],\n  \"rows\": [\n    \"_1\"\n  ],\n  \"vals\": [\n    \"_1\"\n  ],\n  \"exclusions\": {},\n  \"inclusions\": {},\n  \"unusedAttrsVertical\": 85,\n  \"autoSortUnusedAttrs\": false,\n  \"inclusionsInfo\": {},\n  \"aggregatorName\": \"Count Unique Values\",\n  \"rendererName\": \"Table\"\n}"
      },
      "id" : "1E7A35EE8C394A1D8B40AC436F44000F"
    },
    "cell_type" : "code",
    "source" : "1d to 10d by 1d",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "id" : "F56DD5044DF44DF29D8B909EA87D165A"
    },
    "cell_type" : "markdown",
    "source" : "## Plot a list of numerical pairs"
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "presentation" : {
        "tabs_state" : "{\n  \"tab_id\": \"#tab818117191-0\"\n}",
        "pivot_chart_state" : "{\n  \"hiddenAttributes\": [],\n  \"menuLimit\": 200,\n  \"cols\": [],\n  \"rows\": [],\n  \"vals\": [],\n  \"exclusions\": {},\n  \"inclusions\": {},\n  \"unusedAttrsVertical\": 85,\n  \"autoSortUnusedAttrs\": false,\n  \"inclusionsInfo\": {},\n  \"aggregatorName\": \"Count\",\n  \"rendererName\": \"Table\"\n}"
      },
      "id" : "D6886C716031470284074CDBA9D996E9"
    },
    "cell_type" : "code",
    "source" : "(2 to 20 by 2) zip List.fill(10)(scala.util.Random.nextDouble * 10)",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "id" : "AD3BAA1F2963491386F21F1F9DC33C4B"
    },
    "cell_type" : "markdown",
    "source" : "## Plot a list of categorical values"
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "presentation" : {
        "tabs_state" : "{\n  \"tab_id\": \"#tab322693107-0\"\n}",
        "pivot_chart_state" : "{\n  \"hiddenAttributes\": [],\n  \"menuLimit\": 200,\n  \"cols\": [],\n  \"rows\": [],\n  \"vals\": [],\n  \"exclusions\": {},\n  \"inclusions\": {},\n  \"unusedAttrsVertical\": 85,\n  \"autoSortUnusedAttrs\": false,\n  \"inclusionsInfo\": {},\n  \"aggregatorName\": \"Count\",\n  \"rendererName\": \"Table\"\n}"
      },
      "id" : "ABF5FEBF869A4E348412CF1CEBF9AA41"
    },
    "cell_type" : "code",
    "source" : "('a' to 'z').take(10).map(_.toString) zip (2 to 20 by 2)",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "id" : "5A017DE637AD4FB688F5EAAB1618C2F0"
    },
    "cell_type" : "markdown",
    "source" : "## Table of tuples"
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : true,
      "presentation" : {
        "tabs_state" : "{\n  \"tab_id\": \"#tab1508885852-0\"\n}",
        "pivot_chart_state" : "{\n  \"hiddenAttributes\": [],\n  \"menuLimit\": 200,\n  \"cols\": [],\n  \"rows\": [],\n  \"vals\": [],\n  \"exclusions\": {},\n  \"inclusions\": {},\n  \"unusedAttrsVertical\": 85,\n  \"autoSortUnusedAttrs\": false,\n  \"inclusionsInfo\": {},\n  \"aggregatorName\": \"Count\",\n  \"rendererName\": \"Table\"\n}"
      },
      "id" : "432629475CCA4921863E1EC776225804"
    },
    "cell_type" : "code",
    "source" : "val tp = List((nextInt(50),nextInt(50),nextInt(50)), (nextInt(50),nextInt(50),nextInt(50)), (nextInt(50),nextInt(50),nextInt(50)))\ntp",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "id" : "59476583B23242E78C6A14D07FA2528E"
    },
    "cell_type" : "code",
    "source" : "ParallelCoordChart(tp)",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "id" : "B7C2C3C13E89422482002D6376E8FDF2"
    },
    "cell_type" : "markdown",
    "source" : "# Use the types, Luke"
  }, {
    "metadata" : {
      "id" : "CA748EA9A36E448C9E45933547DD84AB"
    },
    "cell_type" : "markdown",
    "source" : "## List of Points"
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "id" : "199C12489799437AA9ED0C8CAEBD91B4"
    },
    "cell_type" : "code",
    "source" : "case class Point(a:Double, b:Int)",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "presentation" : {
        "tabs_state" : "{\n  \"tab_id\": \"#tab799611457-0\"\n}",
        "pivot_chart_state" : "{\n  \"hiddenAttributes\": [],\n  \"menuLimit\": 200,\n  \"cols\": [],\n  \"rows\": [],\n  \"vals\": [],\n  \"exclusions\": {},\n  \"inclusions\": {},\n  \"unusedAttrsVertical\": 85,\n  \"autoSortUnusedAttrs\": false,\n  \"inclusionsInfo\": {},\n  \"aggregatorName\": \"Count\",\n  \"rendererName\": \"Table\"\n}"
      },
      "id" : "DCFE3F7A97AB40838199768D0245AE83"
    },
    "cell_type" : "code",
    "source" : "val points = List.fill(10)(Point((nextDouble * 10000).toInt/100d , nextInt(100)))\npoints",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "id" : "64B1D58F1C6945578453B526048242C6"
    },
    "cell_type" : "code",
    "source" : "LineChart(points)",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "id" : "45FA619F32F345B788BCE0C22DFDBB48"
    },
    "cell_type" : "markdown",
    "source" : "## List of Categorical values"
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "id" : "433A55A9FFD441298C915029FB9E56A7"
    },
    "cell_type" : "code",
    "source" : "case class CategoryValue(a:String, b:Int)",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "presentation" : {
        "tabs_state" : "{\n  \"tab_id\": \"#tab1614947154-0\"\n}",
        "pivot_chart_state" : "{\n  \"hiddenAttributes\": [],\n  \"menuLimit\": 200,\n  \"cols\": [],\n  \"rows\": [],\n  \"vals\": [],\n  \"exclusions\": {},\n  \"inclusions\": {},\n  \"unusedAttrsVertical\": 85,\n  \"autoSortUnusedAttrs\": false,\n  \"inclusionsInfo\": {},\n  \"aggregatorName\": \"Count\",\n  \"rendererName\": \"Table\"\n}"
      },
      "id" : "8E63CE46673B4FBE8556F93B64E54105"
    },
    "cell_type" : "code",
    "source" : "List.fill(10)(CategoryValue(nextString(10), nextInt(100)))",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "id" : "67B38ED17627439385B0FEBB091AC1B6"
    },
    "cell_type" : "markdown",
    "source" : "## Tabular data"
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "id" : "BF0D54037C8641A49C3F5488812DFD19"
    },
    "cell_type" : "code",
    "source" : "case class TabularRepr(a:String, b:Int, c:Double, d:Boolean)",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "id" : "544C5455CDD14D9490046946ED3F514C"
    },
    "cell_type" : "code",
    "source" : "def cs:Stream[String] = \"a\" #:: \"b\" #:: \"c\" #:: cs\nval categs = scala.util.Random.shuffle(cs.take(100).toList)\nval list = List.tabulate(100)(i => TabularRepr(categs(i), nextInt(100), nextDouble, nextBoolean()))",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "id" : "95C0F8835CD04C4581F65B6FD570354B"
    },
    "cell_type" : "markdown",
    "source" : "## Parallel Coordinate"
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "id" : "FE2B8F7812BF415880DDA93B526AF7A6"
    },
    "cell_type" : "code",
    "source" : "case class Multi(v:Int, w:Int, x:Int, y:Int, z:Int)",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "id" : "24815A24143C4B359177F0E59F3CA348"
    },
    "cell_type" : "code",
    "source" : "val dataT = List.fill(50)(Multi(nextInt(5), nextInt(11), nextInt(16), nextInt(25), nextInt(2)))",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "id" : "52AD77E2655D4B08A25C053BD12F9F97"
    },
    "cell_type" : "code",
    "source" : "ParallelCoordChart(dataT)",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "id" : "DE80BD2CED8741FF887B6220F9395F74"
    },
    "cell_type" : "markdown",
    "source" : "##### Plot some stuffs using fields"
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "presentation" : {
        "tabs_state" : "{\n  \"tab_id\": \"#tab1155098241-0\"\n}",
        "pivot_chart_state" : "{\n  \"hiddenAttributes\": [],\n  \"menuLimit\": 200,\n  \"cols\": [],\n  \"rows\": [],\n  \"vals\": [],\n  \"exclusions\": {},\n  \"inclusions\": {},\n  \"unusedAttrsVertical\": 85,\n  \"autoSortUnusedAttrs\": false,\n  \"inclusionsInfo\": {},\n  \"aggregatorName\": \"Count\",\n  \"rendererName\": \"Table\"\n}"
      },
      "id" : "9C899709BFF94F2D84B535D63ECD5DAF"
    },
    "cell_type" : "code",
    "source" : "widgets.display(list, Some((\"a\", \"b\")))",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "id" : "5AE49C10C169422296C6E4C5565AB3C7"
    },
    "cell_type" : "markdown",
    "source" : "##### Want a line plot only for both the boolean category"
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "id" : "CDC7B86FE4B9496C9CB55F29F9D6C947"
    },
    "cell_type" : "code",
    "source" : "LineChart(list, fields=Some((\"b\", \"c\")), groupField=Some(\"d\"))",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "id" : "5A29487D35FD47738B82EDDDA5305499"
    },
    "cell_type" : "markdown",
    "source" : "## Radar"
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "id" : "9EE76E5A3ED046908E737719C155B6E6"
    },
    "cell_type" : "code",
    "source" : "case class Data(name:String,strength:Int,intelligence:Int,charisma:Int,dexterity:Int,luck:Int)",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "id" : "06778D2385DB4A58A5B3583F7623F2D1"
    },
    "cell_type" : "code",
    "source" : "val rdata = \"\"\"\nname,strength,intelligence,charisma,dexterity,luck\nHodor,19,2,4,4,7\nJon Snow,14,15,18,14,7\nTyrion Lannister,8,19,7,5,10\nEddard Stark,12,13,17,12,0\n\"\"\".split(\"\\n\").filterNot(_.trim.size == 0).drop(1).map(_.split(\",\").toList).map{case List(a,b,c,d,e,f) => Data(a,b.toInt,c.toInt,d.toInt,e.toInt,f.toInt)}",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "id" : "01EA27FA6D634746B4F82B27501AC57E"
    },
    "cell_type" : "code",
    "source" : "val r = RadarChart(rdata, labelField=Some(\"name\"))\nr",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "id" : "450ECCD5818448BD9DDC5ABD912F61D9"
    },
    "cell_type" : "code",
    "source" : "r.addAndApply(Array(Data(\"New Guy\",30,5,8,9,10)))",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "id" : "374FE423AD3A42E88C381CC7DDD17DA0"
    },
    "cell_type" : "markdown",
    "source" : "## Plot them all!"
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "id" : "03AE9D5D5CBC44E888993FD67ED9D660"
    },
    "cell_type" : "code",
    "source" : "pairs(list)",
    "outputs" : [ ]
  }, {
    "metadata" : {
      "id" : "84C40EC8FE89407A96822893CFA5041B"
    },
    "cell_type" : "markdown",
    "source" : "## Do It Yourself "
  }, {
    "metadata" : {
      "trusted" : true,
      "input_collapsed" : false,
      "collapsed" : false,
      "id" : "7EEB12918AEE4DE797B3DCB93F59C4EC"
    },
    "cell_type" : "code",
    "source" : "val js = \"\"\"\nfunction(data, headers, chart /*dimple: http://dimplejs.org/*/) {\n  var x = chart.addCategoryAxis(\"x\", \"a\");\n  chart.addMeasureAxis(\"y\", \"b\");\n  chart.addMeasureAxis(\"z\", \"c\");\n  chart.addSeries(\"d\", dimple.plot.bubble);\n  chart.addLegend(140, 10, 360, 20, \"right\");\n  chart.draw();  \n}\n\"\"\"\n\nDiyChart(list, js)",
    "outputs" : [ ]
  } ],
  "nbformat" : 4
}